#ifndef __OLED_H__
#define __OLED_H__

#include <U8g2lib.h>

#define OLED_SPI_PIN_RES                    GET_PIN(C, 5)
#define OLED_SPI_PIN_DC                     GET_PIN(B, 2)
#define OLED_SPI_PIN_CS                     GET_PIN(F, 10)
#define OLED_SPI_PIN_CLK                    GET_PIN(A, 5)
#define OLED_SPI_PIN_MOSI                   GET_PIN(A, 7)
class Oled: public U8G2_SSD1306_128X64_NONAME_F_4W_HW_SPI
{
    private:
        Oled(): U8G2_SSD1306_128X64_NONAME_F_4W_HW_SPI(U8G2_R0, 
                                                    /* cs=*/ OLED_SPI_PIN_CS, 
                                                    /* dc=*/ OLED_SPI_PIN_DC, 
                                                    /* reset=*/ OLED_SPI_PIN_RES)
        {
            this->begin();
        }
        ~Oled()
        {

        }
    public:
        static Oled* getInstance()
        {
            static Oled* _oled = nullptr;
            if (_oled == nullptr)
                _oled = new Oled;
            return _oled;
        }
};

#endif